<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <meta charset="utf-8">
    <title>模板-添加（jquery.form）</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" th:href="@{/layuiadmin/layui/css/layui.css}" href="../../../layuiadmin/layui/css/layui.css"
          media="all">
    <link rel="stylesheet" th:href="@{/css/layui-form-extend.css}">
</head>
<body>
<form id="myForm" method="post" class="layui-form" lay-filter="lay-form" style="padding: 50px;">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label for="resourceName" class="layui-form-label lay-required">资源名称：</label>
            <div class="layui-input-inline">
                <input type="text" id="resourceName" name="resourceName" class="layui-input lay-required" lay-verify="required"
                       placeholder="请输入"
                       autocomplete="off">

            </div>
            <!--<div class="layui-form-mid layui-word-aux" >
              <span style="color: red">*</span>
            </div>-->

        </div>
        <div class="layui-inline">
            <label for="controllerName" class="layui-form-label lay-required">控制器：</label>
            <div class="layui-input-inline">
                <input type="text" id="controllerName" name="controllerName" class="layui-input lay-required" lay-verify="required"
                       placeholder="请输入"
                       autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <label for="actionName" class="layui-form-label lay-required">Action：</label>
            <div class="layui-input-inline">
                <input type="password" id="actionName" name="actionName" class="layui-input" lay-verify="required"
                       placeholder="请输入">
            </div>
        </div>
        <div class="layui-inline">
            <label for="menuImage" class="layui-form-label">菜单图标：</label>
            <div class="layui-input-inline">
                <input type="password" id="menuImage" name="menuImage" class="layui-input" lay-verify="required"
                       placeholder="请输入">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label for="resourceUrl" class="layui-form-label">资源路径：</label>
            <div class="layui-input-inline">
                <input type="text" id="resourceUrl" name="resourceUrl：" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <label for="resourceType" class="layui-form-label">资源参数：</label>
            <div class="layui-input-inline">
                <input type="text" id="resourceType" name="resourceType" class="layui-input" >
            </div>
        </div>
        <div class="layui-inline">
            <label for="parameters" class="layui-form-label">资源类型：</label>
            <div class="layui-input-inline">
                <input type="text" id="parameters" name="parameters" class="layui-input" >
            </div>
        </div>
        <div class="layui-inline">
            <label for="priority" class="layui-form-label">优先级：</label>
            <div class="layui-input-inline">
                <input type="text" id="priority" name="priority" class="layui-input" >
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">系统资源：</label>
        <div class="layui-input-block">
            <input type="radio"  name="sysInit" value="1" title="是" checked>
            <input type="radio"  name="sysInit" value="0" title="否" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">禁用：</label>
        <div class="layui-input-block">
            <input type="radio"  name="deleted" value="1" title="是">
            <input type="radio"  name="deleted" value="0" title="否" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <label for="resourceDesc" class="layui-form-label">描述：</label>
        <div class="layui-input-block">
            <textarea id="resourceDesc" name="resourceDesc" class="layui-textarea"></textarea>
        </div>

    </div>

    <div class="layui-form-item">
        <label for="remark" class="layui-form-label">备注：</label>
        <div class="layui-input-block">
            <textarea id="remark" name="remark" class="layui-textarea"></textarea>
        </div>

    </div>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="lay-submit" id="lay-submit" value="确认">
    </div>

</form>

<script th:src="@{/layuiadmin/layui/layui.js}" src="../../../layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload'], function () {
        var  form = layui.form;

        form.on('submit(lay-submit)', function (data){
            //console.log('11111111111111');
        })
    })
</script>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/jquery.form.js}"></script>

<script type="text/javascript">
    //jquery-form.js   ajax获取submit返回值
    $(function () {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        /** 验证文件是否导入成功  */
        $("#form1").ajaxForm(function (data) {
            if (data.code === 0) {
                layer.msg("保存成功", { time: 1000 }, function () {
                    parent.layui.table.reload("layuiTable", {
                        where: { time: new Date() }
                    });
                    parent.layer.close(index);
                });
            }
        });
    });
</script>


</body>
</html>